1from loguru
import logger
6from omegaconf
import DictConfig
8from .common.camera
import Camera
9from .common.face
import Face
10from .common.face_parts
import FacePartsName
11from .head_pose_estimation.head_pose_normalizer
import HeadPoseNormalizer
12from .head_pose_estimation.face_landmark_estimator
import LandmarkEstimator
13from .models
import create_model
14from .transforms
import create_transform
15from .common.face_model_mediapipe
import FaceModelMediaPipe
18 EYE_KEYS = [FacePartsName.REYE, FacePartsName.LEYE]
25 self.
camera = Camera(config.gaze_estimator.camera_params)
31 self.
_config.gaze_estimator.normalized_camera_distance)
36 model = create_model(self.
_config)
37 checkpoint = torch.load(self.
_config.gaze_estimator.checkpoint,
39 model.load_state_dict(checkpoint[
'model'])
40 model.to(torch.device(self.
_config.device))
56 image = self.
_transform(face.normalized_image).unsqueeze(0)
58 device = torch.device(self.
_config.device)
59 image = image.to(device)
61 prediction = prediction.cpu().numpy()
63 face.normalized_gaze_angles = prediction[0]
64 face.angle_to_vector()
65 face.denormalize_gaze_vector()
torch.nn.Module _gaze_estimation_model
torch.nn.Module _load_model(self)
None estimate_gaze(self, np.ndarray image, Face face)
__init__(self, DictConfig config)
List[Face] detect_faces(self, np.ndarray image)
None _run_ethxgaze_model(self, Face face)